#pragma once

#include "CMultiParentShareableDependencyObject.h"


class CTransform;
class CRenderTarget;
class CMILMatrix;

class HWClip;
class TransformAndClipStack;
class CPlaneProjection;
class CCompositeTransform;


class CTransitionTarget :
	public CMultiParentShareableDependencyObject
{
public:

	enum DirtyMode
	{
		Dirty_All = 0x0,
		Dirty_Transform = 0x1,
		Dirty_Projection = 0x2,
		Dirty_Clip = 0x3,
		Dirty_Opacity = 0x4,
	};

protected: 
	CTransitionTarget(CCoreServices * pCore);
	virtual ~CTransitionTarget();
public: 
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual HRESULT InitInstance();
	virtual XUINT32 GetTypeIndex() const;
	static void NWSetTransformDirty(CDependencyObject * pTarget, enum DirtyFlags::Value flags);
	static void NWSetProjectionDirty(CDependencyObject * pTarget, enum DirtyFlags::Value flags);
	static void NWSetClipDirty(CDependencyObject * pTarget, enum DirtyFlags::Value flags);
	static void NWSetOpacityDirty(CDependencyObject * pTarget, enum DirtyFlags::Value flags);
	void NWSetPropertyDirtyOnTarget(CUIElement * pTarget, enum DirtyFlags::Value flags);


	static HRESULT ApplyClip(CTransform * pTransform, struct XPOINTF origin, struct XRECTF_WH bounds, HWClip * pClip);
	static HRESULT ApplyClip(CTransform * pTransform, struct XPOINTF origin, struct XRECTF_WH bounds, TransformAndClipStack * pTransformsAndClips);
	static void ApplyClip(CTransform * pTransform, struct XPOINTF origin, struct XRECTF_WH bounds, const CMILMatrix * pTransformToClipRectSpace, struct XRECTF_WH * pClipRect);

	HRESULT CloneForTarget(CRenderTarget * pRenderTarget, CTransitionTarget * * ppTransitionTargetClone);
	CPlaneProjection * m_pProjection;
	CCompositeTransform * m_pxf;
	CCompositeTransform * m_pClipTransform;
	XFLOAT m_opacity;
	struct XPOINTF m_ptRenderTransformOrigin; 


public: 
	struct XPOINTF m_ptClipTransformOrigin; 
	enum DirtyMode m_currentDirtyMode;


};